package first.program;

import android.util.Log;
import android.widget.Button;

public class Verify {
	
	int pwLength = 4;
	

	
	
	
   	public boolean noRepeats(Button[][] b, int actrow)
   	{
   		Button userpw[]= new Button[pwLength];
   		for(int i = 0; i < pwLength; i++){
   			userpw[i] = b[actrow][i];
   			Log.i("Verify","userpw is "+userpw[i]);
   		}
   		
   		for(int i = 0; i < pwLength; i++){
   			for(int j = 0; j < pwLength; j++){
   				if(i != j){
   					if(b[actrow][i].getContentDescription().toString().equals(userpw[j].getContentDescription().toString())){
   						Log.i("Verify","FALSE, theres a repeat");
   						return false;
   					}
   							
   				}
   			}
   		}
   		Log.i("Verify","True, theres not a repeat");
   		return true;
   	}
	
	
   	public boolean noRepeats(Button[] b)
   	{
   		Button userpw[]= new Button[pwLength];
   		for(int i = 0; i < pwLength; i++){
   			userpw[i] = b[i];
   			Log.i("Verify","userpw is "+userpw[i]);
   		}
   		
   		for(int i = 0; i < pwLength; i++){
   			for(int j = 0; j < pwLength; j++){
   				if(i != j){
   					if(b[i].getContentDescription().toString().equals(userpw[j].getContentDescription().toString())){
   						Log.i("Verify","FALSE, theres a repeat");
   						return false;
   					}
   							
   				}
   			}
   		}
   		Log.i("Verify","True, theres not a repeat");
   		return true;
   	}
	
	
   	// Boolean statement that returns true if there are no "white circles" in the row
   	// returns false if there is one or more.
   	public boolean noWhites(Button[] b)
	{

		for (int i = 0; i < 4; i++){
			if (b[i].getContentDescription().toString().equals("white"))
			{
				return false;
			}
		}
		return true;
	}
	
   	
   	// Boolean statement that returns true if there are no "white circles" in the active row
   	// returns false if there is one or more.
	public boolean noWhites(Button[][] b, int row)
	{
		for (int i = 0; i < 4; i++){
			if (b[row][i].getContentDescription().toString().equals("white"))
			{
				return false;
			}
		}
		
	return true;
	}
		
}
	
